/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dp.vo;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.struts2.json.annotations.JSON;

/**
 *
 * @author wyr
 */
@Entity
@Table(name = "news_buttons")
//@NamedQueries({@NamedQuery(name = "NewsButtons.findAll", query = "SELECT n FROM NewsButtons n"), @NamedQuery(name = "NewsButtons.findByButtonid", query = "SELECT n FROM NewsButtons n WHERE n.buttonid = :buttonid"), @NamedQuery(name = "NewsButtons.findByButtonname", query = "SELECT n FROM NewsButtons n WHERE n.buttonname = :buttonname"), @NamedQuery(name = "NewsButtons.findByButtontext", query = "SELECT n FROM NewsButtons n WHERE n.buttontext = :buttontext"), @NamedQuery(name = "NewsButtons.findByButtonicon", query = "SELECT n FROM NewsButtons n WHERE n.buttonicon = :buttonicon"), @NamedQuery(name = "NewsButtons.findByButtoncontenttype", query = "SELECT n FROM NewsButtons n WHERE n.buttoncontenttype = :buttoncontenttype"), @NamedQuery(name = "NewsButtons.findByButtontype", query = "SELECT n FROM NewsButtons n WHERE n.buttontype = :buttontype")})
public class NewsButtons implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "buttonid")
    private Integer buttonid;
    @Column(name = "buttonname")
    private String buttonname;
    @Column(name = "buttontext")
    private String buttontext;
    @Column(name = "buttonicon")
    private Integer buttonicon;
    @Column(name = "buttoncontenttype")
    private String buttoncontenttype;
    @Column(name = "buttontype")
    private Integer buttontype;
    @Column(name = "buttonaction")
    private Integer buttonaction;
    @JoinTable(name = "news_catlog_button", joinColumns = {@JoinColumn(name = "buttonid", referencedColumnName = "buttonid")}, inverseJoinColumns = {@JoinColumn(name = "catlogid", referencedColumnName = "catlogid")})
    @ManyToMany(fetch=FetchType.LAZY)
    private Set<NewsCatlog> newsCatlogSet;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "newsButtons")
    private Set<NewsExtendsFirstchannelButtons> newsExtendsFirstchannelButtonsSet;

    public NewsButtons() {
    }

    public NewsButtons(Integer buttonid) {
        this.buttonid = buttonid;
    }

    public Integer getButtonid() {
        return buttonid;
    }

    public void setButtonid(Integer buttonid) {
        this.buttonid = buttonid;
    }

    public String getButtonname() {
        return buttonname;
    }

    public void setButtonname(String buttonname) {
        this.buttonname = buttonname;
    }

    public String getButtontext() {
        return buttontext;
    }

    public void setButtontext(String buttontext) {
        this.buttontext = buttontext;
    }

    public Integer getButtonicon() {
        return buttonicon;
    }

    public void setButtonicon(Integer buttonicon) {
        this.buttonicon = buttonicon;
    }

    public String getButtoncontenttype() {
        return buttoncontenttype;
    }

    public void setButtoncontenttype(String buttoncontenttype) {
        this.buttoncontenttype = buttoncontenttype;
    }

    public Integer getButtontype() {
        return buttontype;
    }

    public void setButtontype(Integer buttontype) {
        this.buttontype = buttontype;
    }
    
    public Integer getButtonaction() {
		return buttonaction;
	}

	public void setButtonaction(Integer buttonaction) {
		this.buttonaction = buttonaction;
	}

	@JSON(serialize=false)   
	public Set<NewsCatlog> getNewsCatlogSet() {
        return newsCatlogSet;
    }

    public void setNewsCatlogSet(Set<NewsCatlog> newsCatlogSet) {
        this.newsCatlogSet = newsCatlogSet;
    }
    @JSON(serialize=false)
    public Set<NewsExtendsFirstchannelButtons> getNewsExtendsFirstchannelButtonsSet() {
        return newsExtendsFirstchannelButtonsSet;
    }

    public void setNewsExtendsFirstchannelButtonsSet(Set<NewsExtendsFirstchannelButtons> newsExtendsFirstchannelButtonsSet) {
        this.newsExtendsFirstchannelButtonsSet = newsExtendsFirstchannelButtonsSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (buttonid != null ? buttonid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NewsButtons)) {
            return false;
        }
        NewsButtons other = (NewsButtons) object;
        if ((this.buttonid == null && other.buttonid != null) || (this.buttonid != null && !this.buttonid.equals(other.buttonid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dp.vo.NewsButtons[buttonid=" + buttonid + "]";
    }

}
